import 'package:flutter/material.dart';


class CommonTag extends StatelessWidget {

  final String title;
  final Color color;
  final Color bgColor;

  const CommonTag.origin(this.title,{Key key, this.color, this.bgColor}) : super(key: key);

  // ignore: missing_return
  factory CommonTag(String title){
    switch(title){
      case '近地铁':
        return CommonTag.origin(title,color:Colors.red,bgColor:Colors.red[50]);
      case '随时看房':
        return CommonTag.origin(title,color:Colors.red,bgColor:Colors.red[50]);
      default:
        return CommonTag.origin(title,color:Colors.green,bgColor:Colors.green[50]);
    }
  }

  @override
  Widget build(BuildContext context) {
    return Container(
      margin: EdgeInsets.only(right:2),
      padding: EdgeInsets.only(left:2,right:2),
      decoration: BoxDecoration(color: bgColor,borderRadius: BorderRadius.circular(4)),
      child: Text(title,style: TextStyle(color:color,fontSize: 12),),
    );
  }
}